const mysql = require('mysql')

function getConnection() {
    const connection = mysql.createConnection({
        host: 'localhost',
        user: 'root',
        password: 'meng',
        database: 'roledemo'
    })
    connection.connect((err) => {
        if (err) {
            console.log(err)
        } else {
            console.log("连接成功！")
        }
    });
    return connection;
}
module.exports=getConnection();
